﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MySQLStudio.Common
{
    public class Logger
    {
        public static string GetExceptionFullContent(Exception exception)
        {
            StringBuilder exceptionContent = new StringBuilder();
           
            while (exception != null)
            {
                exceptionContent.AppendFormat("DESC: {0}{1}", exception.Message, System.Environment.NewLine);

                if ((exception.Source != null) && (exception.Source != string.Empty))
                    exceptionContent.AppendFormat("SOURCE: {0}{1}", exception.Source, System.Environment.NewLine);

                exceptionContent.AppendFormat("{0}{1}", exception.StackTrace, System.Environment.NewLine);
                exceptionContent.Append(System.Environment.NewLine);

                exception = exception.InnerException;
            }            
            
           return exceptionContent.ToString();
        }

    }
}
